package com.dubbo.mapper.other;

import com.dubbo.domain.other.FileInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;
import java.util.Map;
/**
 * 文件mapper
 * @author chenwei
 * @date 2018年3月14日 上午10:33:42
 */
public interface FileInfoMapper extends Mapper<FileInfo>{
	
	/**
	 * 保存图片
	 * 
	 * @author chenwei
	 * @date 2018年3月26日 下午5:38:46
	 * @param fileInfo
	 * @return
	 */
	@Insert("INSERT INTO t_file_info (" + 
			"   id," + 
			"	contentType," + 
			"	size," + 
			"	path," + 
			"	url," + 
			"	type," + 
			"	createTime," + 
			"	updateTime" + 
			" )" + 
			" VALUES" + 
			"	(" + 
			"		#{fileInfo.id}," + 
			"		#{fileInfo.contentType}," + 
			"		#{fileInfo.size}," + 
			"		#{fileInfo.path}," + 
			"		#{fileInfo.url}," + 
			"		#{fileInfo.type}," + 
			"		NOW()," + 
			"		NOW()" + 
			"	)")
	int saveFileInfo(@Param("fileInfo") FileInfo fileInfo);
	/**
	 * 根据url集合删除finleinfo表中的数据
	 * 
	 * @author chenwei
	 * @date 2018年3月28日 下午2:58:50
	 * @param urlList
	 */
	void deleteFileInfoByUrl(@Param("urlList") List<String> urlList);
    
	
	Map<String, Object> findUrlAndUrlIdByUrl(@Param("url") String url);
}